#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <thread>
#include <condition_variable>
#include <mutex>

#include "testsignalhp.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

enum ThreadState{
    IDLE_STATE=0,
    CALCULATE_STATE
};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
protected:
    void OnInitDialog();
private:
    void InitClient();
    void InitWorkThread();
private:
    Ui::MainWindow *ui;
    std::thread m_work_thread{};
    std::mutex m_mutex{};
    std::condition_variable m_cv{};
    bool m_exit{false};
    ThreadState m_state{ThreadState::IDLE_STATE};
    ITcpClient *m_client{};
    testsignalhp m_client_listener{};
};
#endif // MAINWINDOW_H
